getSuggestions

abstract fun getSuggestions(s: String, cursor: Int, choiceValidator: ChoiceValidator<String>): CompletableFuture<Suggestions>

Provide suggestions for the widget based on current widget state. The typical approach involves using either AllowableStrings or AllowableIdentifiers, both of which have a convenient built-in method for generating suggestions.

For example:

//this assumes the ChoiceValidator is a ChoiceValidator<String>
val suggestionProvider = SuggestionProvider {s, c, cv -> allowableIdentifiers.getSuggestions(s, c, cv))}

But of course you can implement a totally custom way to get suggestions as needed.

Return

CompletableFuture<Suggestions<

Author

fzzyhmstrs

Since

0.2.0

Parameters

s

current string input for this widget

cursor

integer position of the cursor relative to the text (0 being the start, and whatever the end index is being the cursor "active" at the end of the string for more typing)

choiceValidator

ChoiceValidator a validator to filter allowable inputs from a set of string sources.

See also